#coding:utf-8

import urllib
# '''
# # 向指定的url发送请求，并返回服务器响应的类文件对象
# #response = urllib2.urlopen("https://www.51miz.com/sound/")
# # 类文件对象支持 文件对象的操作方法，如read()方法读取文件全部内容，返回字符串
# #html=response.read()
#
# # 打印字符串
# #print(html)
# '''
ua_headers={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36 OPR/75.0.3969.171'
}
# url 作为Request()方法的参数，构造并返回一个Request对象
request = urllib.Request("https://www.51miz.com/sound/",headers=ua_headers)

# Request对象作为urlopen()方法的参数，发送给服务器并接收响应
response = urllib.urlopen(request)

html = response.read()

print (response.getcode())

print (html)